<template>
  <van-cell>
    <div class="comment">
      <div class="img">
        <img
          src="https://dss1.baidu.com/70cFfyinKgQFm2e88IuM_a/forum/pic/item/b219ebc4b74543a95632edd416178a82b90114f8.jpg"
          alt=""
        />
      </div>
      <div class="main">
        <div class="xingm">{{ item.aut_name }}</div>
        <div class="contentt">
          {{ item.content }}
        </div>
        <div class="shij">
          <span>{{ item.pubdate | fromtime }}</span>
          <span class="huif" @click="huifu" v-if="isShow === false"
            >回复{{ item.reply_count }}</span
          >
        </div>
      </div>
      <div class="like">
        <div><van-icon name="like" class="likn" />{{ item.like_count }}</div>
      </div>
    </div>
  </van-cell>
</template>

<script>
import bus from '@/utils/bus.js'
export default {
  props: ['item', 'isShow'],
  data () {
    return {}
  },
  methods: {
    // 打开回复的弹框
    huifu () {
      // console.log(this.$parent); list detail 儿子reply里面的show
      this.$parent.$parent.$refs.reply.show = true
      // 把item交给bus ,也就是props接收过来的
      bus.$emit('pomain', this.item)
    }
  }
}
</script>

<style lang="less" scoped>
.comment {
  position: relative;
  display: flex;
  // margin-top: 46px;
  margin-bottom: 10px;
  .img {
    width: 50px;
    height: 50px;
    img {
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }
  }
  .main {
    display: 1;
    margin-left: 10px;
    .xingm {
      color: #7bc7ff;
    }
    .contentt {
      margin: 15px;
    }
  }
  .shij {
    .huif {
      padding: 8px 16px;
      border-radius: 15px;
      background-color: #f4f5f6;
      margin-left: 15px;
    }
  }
  .like {
    position: absolute;
    right: 0;
    top: 0;
    .van-icon-like::before {
      content: '\F07A';
      margin-right: 3px;
    }
  }
}
</style>
